package com.kmdin.DB;

//导入公用操作接口
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class SqlDB {

	public static Connection getConn(){
		Connection objConn = null;
		try{
			ConnString objConnString = new ConnString();
			
			//引入驱动类
			Class.forName(objConnString.getDriver());
			//连接数据库
			objConn = DriverManager.getConnection("jdbc:sqlserver://" + objConnString.getServer()  + ":1433;databaseName=UserInfo;User=root;Password=123456");
		}
		catch(Exception ex)
		{
			Logs objLogs = new Logs();
			objLogs.WriteDebug(ex.getMessage());
		}
		
		return objConn;
	}
	
	public long ExecSql(String Sql) throws SQLException {
		Statement objSt = getConn().createStatement();
		
		return objSt.executeLargeUpdate(Sql);
	}
}